


#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;

class Solution
{
public:
    int iceBreakingGame1(int num, int target)
    {
        int res = 0;

        for (int i = 2; i <= num; ++i)
        {
            res = (res + target) % i;
        }

        return res;
    }

    int iceBreakingGame2(int num, int target)
    {
        return _iceBreakingGame2(num, target);
    }

    int removeDuplicates1(vector<int>& nums)
    {
        int prev = 0, n = nums.size();

        for (int i = 1; i < n; ++i)
        {
            if (nums[prev] != nums[i])
                swap(nums[++prev], nums[i]);
        }

        return ++prev;
    }

    int removeDuplicates2(vector<int>& nums)
    {
        unordered_set<int> hash;
        int prev = -1, n = nums.size();

        for (int i = 0; i < n; ++i)
        {
            if (0 == hash.count(nums[i]))
            {
                swap(nums[++prev], nums[i]);
                hash.insert(nums[prev]);
            }
        }

        return ++prev;
    }

private:
    int _iceBreakingGame2(int n, int target)
    {
        if (1 == n)
            return 0;

        return (_iceBreakingGame2(n - 1, target) + target) % n;
    }
};

void Test1()
{
	cout << -3 % 5 << endl;
}

int main()
{
	Test1();

	return 0;
}